import request from '@/utils/request';
import qs from 'qs';

export function query(params) {
  return request({
    url: process.env.VUE_APP_ORDER_API + '/order/query/subOrder/page',
    method: 'get',
    params
  });
}
// 查询所有套餐
export function operPackage() {
  return request({
    url: process.env.VUE_APP_PRODUCT_API + '/oper/package/queryAll',
    method: 'get'
  });
}
// 查询所有产品
export function operProduct() {
  return request({
    url: process.env.VUE_APP_PRODUCT_API + '/oper/product/queryAll',
    method: 'get'
  });
}
// 查询诊所 所在省市 下拉
export function saleArea(params) {
  return request({
    url: process.env.VUE_APP_SALEAREA_API + '/org/salearea/query/son',
    method: 'get',
    params
  });
}
// 导出数据
export function download(url, params) {
  return request({
    url: process.env.VUE_APP_ORDER_API + url + '?' + qs.stringify(params, { indices: false }),
    method: 'get',
    responseType: 'blob'
  });
}
export function add(data) {
  return request({
    url: 'his-order/tOrder/create',
    method: 'post',
    data
  });
}

export function del(ids) {
  return request({
    url: 'his-order/tOrder/delete',
    method: 'delete',
    data: ids
  });
}

export function edit(data) {
  return request({
    url: 'his-order/tOrder/update',
    method: 'put',
    data
  });
}

export default { add, edit, del };
